using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_Bill_BalanceMap : EntityTypeConfiguration<SO_Bill_Balance>
    {
        public SO_Bill_BalanceMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Date, t.Total_Amount, t.Bill_Currency });

            // Properties
            this.Property(t => t.Bill__)
                .HasMaxLength(8);

            this.Property(t => t.Type)
                .HasMaxLength(7);

            this.Property(t => t.Closed)
                .HasMaxLength(5);

            this.Property(t => t.Bill_Currency)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.Patient__)
                .HasMaxLength(6);

            this.Property(t => t.Patient)
                .HasMaxLength(80);

            this.Property(t => t.Guarantor1__)
                .HasMaxLength(6);

            this.Property(t => t.Guarantor_1)
                .HasMaxLength(80);

            this.Property(t => t.Guarantor_2)
                .HasMaxLength(80);

            this.Property(t => t.Guarantor2__)
                .HasMaxLength(6);

            // Table & Column Mappings
            this.ToTable("SO_Bill_Balance");
            this.Property(t => t.Bill__).HasColumnName("Bill_#");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Closed).HasColumnName("Closed");
            this.Property(t => t.Total_Amount).HasColumnName("Total_Amount");
            this.Property(t => t.Bill_Currency).HasColumnName("Bill_Currency");
            this.Property(t => t.Patient__).HasColumnName("Patient_#");
            this.Property(t => t.Patient).HasColumnName("Patient");
            this.Property(t => t.Patient_Amount).HasColumnName("Patient_Amount");
            this.Property(t => t.Patient_balance).HasColumnName("Patient_balance");
            this.Property(t => t.Guarantor1__).HasColumnName("Guarantor1_#");
            this.Property(t => t.Guarantor_1).HasColumnName("Guarantor_1");
            this.Property(t => t.Guarantor1_Amount).HasColumnName("Guarantor1_Amount");
            this.Property(t => t.Guarantor1_balance).HasColumnName("Guarantor1_balance");
            this.Property(t => t.Guarantor_2).HasColumnName("Guarantor_2");
            this.Property(t => t.Guarantor2__).HasColumnName("Guarantor2_#");
            this.Property(t => t.Guarantor2_Amount).HasColumnName("Guarantor2_Amount");
            this.Property(t => t.Guarantor2_balance).HasColumnName("Guarantor2_balance");
            this.Property(t => t.Physicians_Amount).HasColumnName("Physicians_Amount");
            this.Property(t => t.Physicians_balance).HasColumnName("Physicians_balance");
        }
    }
}
